package org.hs.phd.common.randomnumbers;

import java.util.Random;

public class GaussianRandomNumberGenerator implements RandomNumberGenerator{

	private final Random random;
	private final float mean;
	private final float stdDev;


	public GaussianRandomNumberGenerator(){
		this(0,1);
	}
	
	
	public GaussianRandomNumberGenerator(float mean, float stdDev) {
		this(new Random(), mean, stdDev);
	}


	public GaussianRandomNumberGenerator(Random random, float mean, float stdDev) {
		this.random = random;
		this.mean = mean;
		this.stdDev = stdDev;
	}


	@Override
	public float nextRandom() {
		return (float)(mean + stdDev*random.nextGaussian());
	}
	

}
